<template>
    <view class="goods">
        <view class="f ai-c list ph-32 pv-32 mb-20" v-for="(item, index) in list" :key="index" @click="toDetail(item)">
            <image :src="item.picUrl" class="w-130 h-130 b-12 mr-24"></image>
            <view class="f ai-c js-c-b f1">
                <view class="f fd-c f1">
                    <view class="fs-32 fw-600 text-color4">{{item.storeName}}</view>
                    <view class="f mt-5 ai-c">
                        <image :src="index > item.scores-1 ? star : starSelect" class="w-24 h-24 mr-8" v-for="(item, index) in 5" :key="index"></image>
                    </view>
                    <view class="f mt-12">
                        <view class="fs-26 text-color3">店铺描述：</view>
                        <view class="f f1"><view class="text-ellipsis-1 fs-26 text-color2">{{item.introduction}}</view></view>
                    </view>
                </view>
                <image src="http://cwht.ricecs.cn/app/index/star-select.png" class="w-32 h-32 ml-32"></image>
            </view>
        </view>
    </view>
</template>
<script setup lang="ts">

import { ref } from 'vue';
import star from '@/static/index/star.png';
import starSelect from '@/static/index/star-select.png';
import { favoriteLists } from '@/services/api/mine/index';
import { favoriteDelete } from '@/services/api/shop/collect';
const list = ref<any[]>([]);
const listQuery = ref({
    pageNo: 1,
    pageSize: 10,
	collectionType:3
});
getContentPage();
async function getContentPage() {
	    const { data } = await favoriteLists(listQuery.value);
	    if (data.list.length > 0) {
	        data.list.forEach((item: any, index: number) => {
				list.value.push(item);
	        });
	    }
	}	
async function fav(item:any) {
	 await favoriteDelete({ spuId: item.id });
	   listQuery.value.pageNo = 1
	   getContentPage();
	}	
	function toDetail(item: any){
		uni.navigateTo({
		    url: `/pages_shop/business/index?id=${item.id}`,
		});
	};
</script>
<style lang="scss" scoped>
.goods {
    background: #f5f5f5;
    min-height: 100vh;
    .list {
        background: #fff;
    }
}
</style>
